package lab02.test20;

/**
 * Created by lenovo on 2017/10/31.
 */

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        //用户从键盘输入一行含有数字和字符的字符串，
        // 程序仅仅输出字符串中的全部数字字符
        System.out.println("请输入一行含有数字和字符的字符串：");
        Scanner scanner = new Scanner(System.in);
        String string = scanner.next();
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = 0; i < string.length(); i++) {
            char tmp = string.charAt(i);
            if (tmp >= '0' && tmp <= '9') {
                stringBuffer.append(tmp);
            }
        }
        System.out.println(stringBuffer.toString());
    }
}
